import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import Navigation from '../views/Navigation.vue'
import LoginView from '../views/LoginView.vue'
import ComboView from '../views/ComboView.vue'
import RegisterView from '../views/RegisterView.vue'
import GroupView from '../views/GroupView.vue'
import ItemView from '../views/ItemView.vue'
import EsView from '../views/EsView.vue'

Vue.use(VueRouter)

const routes: Array<RouteConfig> = [
  {
    path: '/',
    name: 'navigation',
    component: Navigation,
    children:[
      {
        path: '/register',
        name: 'register',
        component: RegisterView
      },
      {
        path: '/login',
        name: 'login',
        component: LoginView
      },
      {
        path: '/group/list',
        name: 'group',
        component: GroupView
      },
      {
        path: '/es',
        name: 'es',
        component: EsView
      },
      {
        path: '/list',
        name: 'List',
        component: ComboView
      },
      {
        path: '/item/list',
        name: 'item',
        component: ItemView
      },
    ]
  },

  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
